<html><head><title>InsertXMLStructure</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<font face="Verdana, sans-serif" size="2"><p align="center"><b><font size="4">InsertXMLStructure()</font></b></p>
<p><b>Syntax</b></p><blockquote>
Result = <font color="#3A3966"><b>InsertXMLStructure</b></font>(ParentNode, *Buffer, Structure [, PreviousNode])</blockquote>

</blockquote>
<b>Description</b><br><blockquote>

Insert the specified structure memory as a new XML node into the given parent node. 

</blockquote><p><b>Parameters</b></p><blockquote>
<style type="text/css">
table.parameters { border-spacing: 0px; border-style: none; border-collapse: collapse; }
table.parameters td { border-width: 1px; padding: 6px; border-style: solid; border-color: gray; vertical-align: top; font-family:Arial; font-size:10pt; }
</style>
<table width="90%" class="parameters">
<tr><td width="10%"><i>ParentNode</i></td>
<td width="90%"> 
The node into which to insert the new node. To insert the new node 
at the root of the tree, <a href="rootxmlnode.html">RootXMLNode()</a> can be used here. 

</td></tr>
<tr><td><i>*Buffer</i></td>
<td> 
The address of the structure to insert into the XML tree. 

</td></tr>
<tr><td><i>Structure</i></td>
<td> 
The type of the structure to insert. 

</td></tr>
<tr><td><i>PreviousNode (optional)</i></td>
<td> 
A childnode of 'ParentNode' after which the new node should 
be inserted. If this value is 0 or not specified, the new node is inserted as the first child of 
its parent. If this value is -1, the node is inserted as the last child of its parent. 

</td></tr>
</table>
</blockquote><p><b>Return value</b></p><blockquote>

The new XML node if it was created successfully or zero if no node could 
be inserted at this point. 

</blockquote><p><b>Remarks</b></p><blockquote>

The rules specified in the <a href="createxmlnode.html">CreateXMLNode()</a> for where a new node can be inserted 
also apply to this function. 
<br>
<br>
The inserted node is named like the structure. Each structure element is added 
as a sub-node inside the structure node. Any '*' or '$' character is stripped from 
the name of the structure element. If the structure element contains an array, list, 
map or structure, more nodes are added recursively. 
See below for an example of the created XML. 

</blockquote><p><b>Example</b></p><blockquote>

<pre><font face="Courier New, Courier, mono"size="2">  <font color="#3A3966">; This example produces the following XML tree:</font>
  <font color="#3A3966">;</font>
  <font color="#3A3966">; &lt;Person&gt;</font>
  <font color="#3A3966">;   &lt;Name&gt;John Smith&lt;/Name&gt;</font>
  <font color="#3A3966">;   &lt;Age&gt;42&lt;/Age&gt;</font>
  <font color="#3A3966">;   &lt;Books&gt;</font>
  <font color="#3A3966">;     &lt;element&gt;Investing For Dummies&lt;/element&gt;</font>
  <font color="#3A3966">;     &lt;element&gt;A Little Bit of Everything For Dummies&lt;/element&gt;</font>
  <font color="#3A3966">;   &lt;/Books&gt;</font>
  <font color="#3A3966">; &lt;/Person&gt;  </font>
  <font color="#3A3966">;</font>
  <b><font color="#3A3966">Structure</font></b> Person
    Name$
    Age.l
    <b><font color="#3A3966">List</font></b> <font color="#3A3966">Books</font>.s()
  <b><font color="#3A3966">EndStructure</font></b>
  
  <b><font color="#3A3966">Define</font></b> P.Person
  
  P\Name$ = &quot;John Smith&quot;
  P\Age   = 42
<font color="#3A3966">  AddElement</font>(P\<font color="#3A3966">Books</font>()): P\<font color="#3A3966">Books</font>() = &quot;Investing For Dummies&quot;
<font color="#3A3966">  AddElement</font>(P\<font color="#3A3966">Books</font>()): P\<font color="#3A3966">Books</font>() = &quot;A Little Bit of Everything For Dummies&quot;

  <b><font color="#3A3966">If</font></b> <font color="#3A3966">CreateXML</font>(0)
<font color="#3A3966">    InsertXMLStructure</font>(<font color="#3A3966">RootXMLNode</font>(0), @P, Person)
<font color="#3A3966">    FormatXML</font>(0, <font color="#924B72">#PB_XML_ReFormat</font>)
    <b><font color="#3A3966">Debug</font></b> <font color="#3A3966">ComposeXML</font>(0)
  <b><font color="#3A3966">EndIf</font></b>
</font></pre>

</blockquote><p><b>See Also</b></p><blockquote>

<a href="extractxmlstructure.html">ExtractXMLStructure()</a>, <a href="insertxmlarray.html">InsertXMLArray()</a>, <a href="insertxmllist.html">InsertXMLList()</a>, <a href="insertxmlmap.html">InsertXMLMap()</a> 

</Blockquote><p><b>Supported OS </b><Blockquote>All</Blockquote></p><center><- <a href=insertxmlmap.html>InsertXMLMap()</a> - <a href="index.html">XML Index</a> - <a href="isxml.html">IsXML()</a> -><br><br>

</body></html>